/**
 * 教师代表页面的控制器
 * Created by limeng on 16/4/22.
 */
delegateApp.controller('MainContentCtrl', function ($rootScope, $scope, $http) {
    $scope.myProposalCount = {};
    $scope.newProposalList = [];

    $http.get('/proposal/count/'+$rootScope.delegate.id).success(function (data) {
        if (data.status == true) {
            $scope.myProposalCount = data.result;
        }
    });
    $http.get('/proposal/newProposalList/10/1').success(function (data) {
        if (data.state == true) {
            $scope.newProposalList = data.list;
        }
    });

    $scope.generateGreeting = function () {
        var myDate = new Date();
        var hour = myDate.getHours();
        if (hour >= 8 && hour <12) {
            return '上午';
        } else if (hour >= 12 && hour < 18) {
            return '下午';
        } else if (hour >= 18 && hour < 21) {
            return '晚上';
        } else if (hour >= 21 && hour <= 23 || hour >=0 && hour < 5) {
            return '深夜';
        } else {
            return '早上';
        }
    };
});